//首页
EPS.index={
    i:function(){
        this.page.i();
        this.btn.i();
    },
    page:{
        i:function(){
            this.calendar();
            this.size();
            this.resize();
        },
        size:function(){//中间模块高度计算
            var mBox=fui.$('.mod-mBox'),H=mBox.height(),W=mBox.width(),$b=fui.$('.mod-mBox .mBox-item .mi-bd');
            var col;
            if(H<640){
                col=W>1350?3:2;
                $b.css('height',H-131)
            }else{
                col=W>1350?6:4;
                $b.css("height",(H-15)/2-131)
            }
            if(H<520){
                fui.$('.calendar-mBox').hide();
                fui.$('.cLog-text').css('height',H-200)
            }else{
                fui.$('.calendar-mBox').show();
                fui.$('.cLog-text').css('height',H-444)
            }
            var $m=[],mNum=-1;
            fui.$('.mod-mBox .mBox-item').each(function(m,n){
                var _n=fui.$(n);
                if(m%col==0){
                    mNum++;
                    $m[mNum]=fui.$('<div>').addClass('mBox-scroll mBox-scroll-'+mNum);
                }
                if(col==3||col==6){
                    _n.css('width','33.33%')
                }else{
                    _n.css('width','50%')
                }
                $m[mNum].append(_n);
            });
            mBox.empty();
            var mNav=fui.$('<div>').addClass('mBox-nav').appendTo(mBox);
            for(var j=0;j<$m.length;j++){
                mBox.append($m[j]);
                mNav.append('<span></span>')
            }
            mNav.find('span').eq(0).addClass('active');
            fui.$('.mBox-scroll-0').addClass('box-show');
            var lastItem=fui.$('.mBox-scroll-'+mNum).find('.mBox-item');
            switch (lastItem.length){
                case 1:
                    lastItem.css('width','100%');
                    lastItem.find('.mi-bd').css('height',H-131);
                    break;
                case 2:
                    lastItem.css('width','50%');
                    lastItem.find('.mi-bd').css('height',H-131);
                    break;
                case 3:
                    lastItem.find('.mi-bd').css('height',H-131);
                    break;
            }
        },
        resize:function(){
            fui.$(window).resize(function(){
                EPS.index.page.size();
            });
        },
        calendar:function(){
            JsDate('.calendar-mBox').render({
                dateType:2,
                info:function(m,d,w){
                    fui.$('.cnd-num').text(d);
                    fui.$('.cn-month').text(m+'月');
                    fui.$('.cn-week').text(w);
                }
            });
        }
    },
    btn:{
        i:function(){
            this.bSwitch();
        },
        bSwitch:function(){
            fui.$('body').on('click','.mBox-nav span',function(){
                var _t=fui.$(this),idx=_t.index();
                _t.addClass('active').siblings().removeClass('active');
                fui.$('.mBox-scroll-'+idx).addClass('box-show').siblings().removeClass('box-show')
            })
        }
    }
};

//招聘登记
EPS.employ={
    d:{},
    i:function(){
        this.page.i();
        this.btn.i();
    },
    time:{
        ai:function(){
            var today=new Date().Format('yyyy-MM-dd');
            var start={
                format:'YYYY-MM-DD hh:mm',
                zIndex:12345678,
                minDate:today+' 00:00:00',
                okfun:function(v){
                    end.minDate =v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                    endDates();
                }
            };
            var end={
                format:'YYYY-MM-DD hh:mm',
                zIndex:12345678,
                minDate:today+' 00:00:00',
                okfun:function(v){
                    start.maxDate=v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                }
            };
            function endDates() {
                //end.trigger = false;
                $.jeDate('[name="interviewerTime"]',end);
            }
            $.jeDate('[name="contactTime"]',start);
            $.jeDate('[name="interviewerTime"]',end);
        }
    },
    page:{
        i:function(){
            this.loadTable();
            JsForm().skin();
        },
        loadTable:function(){
            EPS.employ.d.eTable=JsTable('.mod-table').render({
                height:'full-200',
                limit:20,
                fixed:'left',
                checkbox:true,
                map:{
                    name:'userInfo.name'
                },
                cols:[
                    {field:'name',title:'姓名',width:100,filter:true},
                    {field:'phone',title:'联系电话',width:110,sort:true},
                    {field:'job',title:'应聘岗位',width:110},
                    {field:'department',title:'面试部门',width:100},
                    {field:'interviewer',title:'面试官',width:100},
                    {field:'interviewerTime',title:'面试时间',width:140},
                    {field:'interview',title:'面试地点',width:150},
                    {field:'state',title:'当前状态',width:100,align:'center',className:'employ-state',fun:function(key){return key[0]['status']}},
                    {field:'contactTime',title:'联系时间',width:120},
                    {field:'sms',title:'发送短信提醒',align:'center',width:120,fun:function(key,idx){return key==1?'已发送':'<a href="javascript:EPS.employ.btn.sendSMS('+idx+');" class="btn btn-small btn-rounded btn-green">发送短信</a>'}},
                    {field:'sendTime',title:'发送时间',width:155}
                ],
                staticData:epsData.employ
            });
        }
    },
    btn:{
        i:function(){
            this.stateList();
        },
        addInterview:function(){
            var ly=layer.open({
                title:'添加面试约定',
                content:fui.$("#addInterview").html(),
                btn:['保存','继续添加','取消'],
                skin:'tips-1',
                resize:!1,
                yes:function(){
                    JsForm('.addInterviewForm').submit(function(r){
                        if(r.code==1){
                            epsData.addInterview(r.result,function(){
                                layer.close(ly);
                                layer.msg('添加成功');
                                EPS.employ.d.eTable.reload();
                            })
                        }else{
                            layer.msg(r.msg)
                        }
                    },1);
                },
                btn2:function(){
                    JsForm('.addInterviewForm').submit(function(r){
                        if(r.code==1){
                            epsData.addInterview(r.result,function(){
                                layer.msg('添加成功');
                                EPS.employ.d.eTable.reload();
                                fui.$('.tips-1').find('.layer-content').empty().append(fui.$("#addInterview").html())
                            })
                        }else{
                            layer.msg(r.msg)
                        }
                    },1);
                    return false;
                }
            });
            EPS.employ.time.ai();
        },
        InterviewRecords:function(){
            EPS.employ.d.eTable.checkBack(function(ck,cp){
                if(ck.length==0) return layer.msg('请先勾选');
                var nd={
                    ids:JSON.stringify(cp[0]),
                    names:cp[1].join(','),
                    phones:cp[2].join(','),
                    genders:cp[3].join(','),
                    contactTimes:cp[4].join(',')
                };
                nd.department=fui.array.same(cp[5]);
                nd.job=fui.array.same(cp[6]);
                nd.interviewer=fui.array.same(cp[7]);
                var ly=layer.open({
                    title:'面试记录',
                    content:JsTpl().render(nd,'interviewRecords'),
                    btn:['保存','取消'],
                    resize:!1,
                    skin:'tips-1',
                    yes:function(){
                        JsForm('.interviewRecordsForm').submit(function(r){
                            if(r.code==1){
                                layer.close(ly);
                                layer.msg('面试记录修改成功');
                                EPS.employ.d.eTable.reload();
                            }else{
                                layer.msg(r.msg)
                            }
                        })
                    }
                });
                JsForm('.interviewRecordsForm').render();
            },['id','userInfo.name','phone','userInfo.sex','contactTime','department','job','interviewer']);
        },
        delEmploy:function(){
            EPS.employ.d.eTable.checkBack(function(ck,cp){
                if(ck.length==0) return layer.msg('请先勾选');
                var ly=layer.open({
                    title:'删除',
                    content:'确认删除此记录？',
                    skin:'tips-ts',
                    btn:['确定','取消'],
                    yes:function(){
                        layer.close(ly);
                        console.log('需要删除的id数组'+cp[0]);
                        layer.msg('删除成功');
                        EPS.employ.d.eTable.reload();
                    }
                });
            },'id')
        },
        sendSMS:function(idx){
            EPS.employ.d.eTable.dataBack(idx,function(r){
                var oText=r.name+'您好，您与方阵人才预约'+r.interviewerTime+'面试，地点在'+r.interview+'，岗位为'+r.job+'，敬请按时赴约。 \n 欢迎关注人事云，助力企业发展，http://www.eyuangong.com/ehr.apk';
                var cText=r.interviewer+'您好，人事部预约'+r.interviewerTime+'面试'+r.job+'岗位'+r.name+'，请提前做好准备。';
                var ly=layer.open({
                    title:'发送短信',
                    content:JsTpl().render(r,'sendSMS'),
                    btn:['确定发送'],
                    skin:'tips-2',
                    yes:function(){
                        var nj={id:r.id};
                        if(!fui.$('#ssh-1').prop('checked')&&!fui.$('#ssh-2').prop('checked')) return layer.msg('没有选择需要发送的对象');
                        fui.$('#ssh-1').prop('checked')?nj.applicant=fui.$('.sendSMSBox [name="applicant"').val():'';
                        fui.$('#ssh-2').prop('checked')?nj.interviewer=fui.$('.sendSMSBox [name="interviewer"').val():'';
                        console.log('提交数据到后台'+JSON.stringify(nj));
                        layer.close(ly);
                        layer.open({
                            title:'提示',
                            content:'发送成功',
                            skin:'tips-ts'
                        })
                    }
                });
                fui.$('.sendSMSBox [name="applicant"').val(oText);
                fui.$('.sendSMSBox [name="interviewer"').val(cText)
            });
        },
        batchSMS:function(){
            EPS.employ.d.eTable.checkBack(function(ck,cp){
                if(ck.length==0) return layer.msg('请先勾选');
                if(ck.length==1){
                    ck=ck[0];
                    var oText=ck.name+'您好，您与方阵人才预约'+ck.interviewerTime+'面试，地点在'+ck.interview+'，岗位为'+ck.job+'，敬请按时赴约。 \n 欢迎关注人事云，助力企业发展，http://www.eyuangong.com/ehr.apk';
                    var cText=ck.interviewer+'您好，人事部预约'+ck.interviewerTime+'面试'+ck.job+'岗位'+ck.name+'，请提前做好准备。';
                    var ly=layer.open({
                        title:'发送短信',
                        content:JsTpl().render(ck,'sendSMS'),
                        btn:['确定发送'],
                        skin:'tips-2',
                        yes:function(){
                            var nj={id:ck.id};
                            if(!fui.$('#ssh-1').prop('checked')&&!fui.$('#ssh-2').prop('checked')) return layer.msg('没有选择需要发送的对象');
                            fui.$('#ssh-1').prop('checked')?nj.applicant=fui.$('.sendSMSBox [name="applicant"').val():'';
                            fui.$('#ssh-2').prop('checked')?nj.interviewer=fui.$('.sendSMSBox [name="interviewer"').val():'';
                            console.log('提交数据到后台'+JSON.stringify(nj));
                            layer.close(ly);
                            layer.open({
                                title:'提示',
                                content:'发送成功',
                                skin:'tips-ts'
                            })
                        }
                    });
                    fui.$('.sendSMSBox [name="applicant"').val(oText);
                    fui.$('.sendSMSBox [name="interviewer"').val(cText)
                }else{
                    var ly2=layer.open({
                        title:'批量发送短信',
                        content:fui.$('#sendSMS').html(),
                        skin:'tips-2',
                        btn:['确定发送'],
                        yes:function(){
                            var nj={id:JSON.stringify(cp[0])};
                            if(!fui.$('#ssh-1').prop('checked')&&!fui.$('#ssh-2').prop('checked')) return layer.msg('没有选择需要发送的对象');
                            fui.$('#ssh-1').prop('checked')?nj.applicant=fui.$('.sendSMSBox [name="applicant"').val():'';
                            fui.$('#ssh-2').prop('checked')?nj.interviewer=fui.$('.sendSMSBox [name="interviewer"').val():'';
                            console.log('提交数据到后台'+JSON.stringify(nj));
                            layer.close(ly2);
                            layer.open({
                                title:'提示',
                                content:'发送成功',
                                skin:'tips-ts'
                            })
                        }
                    })
                }
            },'id');
        },
        stateList:function(){
            var body=fui.$('body'),dict={};
            body.on('mouseenter','.employ-state-box',function(){
                dict.isEsb=true;
            }).on('mouseleave','.employ-state-box',function(){
                dict.isEsb=false;
                fui.$('.employ-state-box').remove()
            });
            body.on('mouseenter','.fui-td-employ-state',function(){
                var _t=fui.$(this),idx=_t.parent().index();
                dict.time=setTimeout(function(){
                    EPS.employ.d.eTable.dataBack(idx,function(db){
                        var os={
                            top:_t.offset().top,
                            left:_t.offset().left,
                            w:_t.outerWidth(),
                            h:_t.outerHeight()
                        },ws={
                            w:fui.$(window).width(),
                            h:fui.$(window).height()
                        },ms={left:0,top:-os.h};
                        var $eBox=fui.$('<div/>').addClass('employ-state-box').appendTo(body);
                        var $eMark=fui.$('<div/>').addClass('esb-mark').appendTo($eBox);
                        if(os.left+260>ws.w){
                            os.left-=(260-os.w);
                            ms.left=260-os.w;
                            $eBox.addClass('ebs-right')
                        }
                        var fy,$bd=fui.$('<div/>').addClass('esb-bd').appendTo($eBox);
                        fui.$.each(db.state,function(x,y){
                            var year=parseInt(y.time.split('-')[0]),ny=new Date(y.time).Format('MM月dd日');
                            if(fy){
                                if(fy==year){
                                    fui.$('<div/>').addClass('esb-item').append('<div class="esb-item-left">'+ny+'</div><span></span><div class="esb-item-right">'+y.status+'</div>').appendTo($bd);
                                }else{
                                    fui.$('<div/>').addClass('esb-item').append('<span class="esb-year">'+fy+'</span>').appendTo($bd);
                                    fui.$('<div/>').addClass('esb-item').append('<div class="esb-item-left">'+ny+'</div><span></span><div class="esb-item-right">'+y.status+'</div>').appendTo($bd);
                                    fy=year;
                                }
                            }else{
                                fy=year;
                                fui.$('<div/>').addClass('esb-item').append('<div class="esb-item-left">'+ny+'</div><span></span><div class="esb-item-right">'+y.status+'</div>').appendTo($bd);
                            }
                        });
                        if(os.top+180+os.h>ws.h){
                            os.top-=($eBox.outerHeight() + 1);
                            ms.top=$eBox.outerHeight() + 1;
                            $eBox.addClass('ebs-top')
                        }else{
                            os.top=os.top+os.h
                        }
                        $eBox.css({top:os.top,left:os.left});
                        $eMark.css({width:os.w,height:os.h,top:ms.top,left:ms.left});
                        dict.isEsb=true;
                    })
                },200);
            }).on('mouseleave','.fui-td-employ-state',function(e){
                clearTimeout(dict.time);
                if(!dict.isEsb){
                    fui.$('.employ-state-box').remove()
                }
            });
        },
        toSearch:function(v){
            v='object'===typeof v?fui.$(v).prev('.search-ipt').val():v;
            v=v.replace(/\s/gi,'');
            if(v){
                console.log('搜索 '+v);
            }

        }
    }
};
//员工信息管理
EPS.staff={
    d:{},
    i:function(){
        this.page.i();
        this.btn.i();
    },
    com:{
        table_0:function(reLoad){
            if(reLoad||!EPS.staff.d.Table1){
                EPS.staff.d.Table1=JsTable('.tsc-table[data-table="1"]').render({
                    limit:10,
                    checkbox:true,
                    cols:[
                        {field:'units',title:'工作单位',width:150},
                        {field:'entryTime',title:'入职日期',width:120},
                        {field:'departureTime',title:'离职日期',width:120},
                        {field:'department',title:'所在部门',width:100},
                        {field:'job',title:'岗位',width:100},
                        {field:'Proficient',title:'精通何种工作',width:150},
                        {field:'reason',title:'离职原因'},
                        {field:'references',title:'证明人',width:100},
                        {field:'phone',title:'联系电话',width:110}
                    ],
                    staticData:epsData.staffGz
                });
            }
        },
        table_1:function(reLoad){
            if(reLoad||!EPS.staff.d.Table2){
                EPS.staff.d.Table2=JsTable('.tsc-table[data-table="2"]').render({
                    limit:10,
                    checkbox:true,
                    cols:[
                        {field:'student',title:'学籍状态',width:120},
                        {field:'graduated',title:'毕业学校',width:140},
                        {field:'degreeType',title:'学历类型',width:120},
                        {field:'degreeLevel',title:'学历层次',width:100},
                        {field:'professional',title:'专业名称',width:120},
                        {field:'degree',title:'学位',width:100},
                        {field:'educational',title:'学制'},
                        {field:'admissionTime',title:'入学时间',width:130},
                        {field:'graduationTime',title:'毕业时间',width:130}
                    ],
                    staticData:epsData.staffJy
                });
            }
        },
        table_2:function(reLoad){
            if(reLoad||!EPS.staff.d.Table3){
                EPS.staff.d.Table3=JsTable('.tsc-table[data-table="3"]').render({
                    limit:10,
                    checkbox:true,
                    cols:[
                        {field:'training',title:'培训机构',width:150},
                        {field:'startTime',title:'培训开始时间',width:120},
                        {field:'endTime',title:'培训结束时间',width:120},
                        {field:'trainingContent',title:'培训内容',width:160},
                        {field:'certificate',title:'获得证书'}
                    ],
                    staticData:epsData.staffPx
                });
            }
        },
        table_3:function(reLoad){
            if(reLoad||!EPS.staff.d.Table4){
                EPS.staff.d.Table4=JsTable('.tsc-table[data-table="4"]').render({
                    limit:10,
                    checkbox:true,
                    cols:[
                        {field:'professional',title:'职业资格信息',width:150},
                        {field:'certificateName',title:'证书名称',width:120},
                        {field:'certificateNumber',title:'证书编号',width:120},
                        {field:'titleLevel',title:'职称级别',width:100},
                        {field:'titleTime',title:'职称取得日期',width:120},
                        {field:'titleSeries',title:'职称所属系列',width:130},
                        {field:'license',title:'发证机关',width:120}
                    ],
                    staticData:epsData.staffZy
                });
            }
        },
        table_4:function(reLoad){
            if(reLoad||!EPS.staff.d.Table5){
                EPS.staff.d.Table5=JsTable('.tsc-table[data-table="5"]').render({
                    limit:10,
                    checkbox:true,
                    cols:[
                        {field:'professional',title:'家庭成员',width:120},
                        {field:'certificateName',title:'出生日期',width:140},
                        {field:'certificateNumber',title:'职务',width:120},
                        {field:'titleLevel',title:'与员工关系',width:120},
                        {field:'titleTime',title:'所在单位',width:200},
                        {field:'titleSeries',title:'联系电话',width:110}
                    ],
                    staticData:epsData.staffZy
                });
            }
        },
        table_5:function(){

        },
        time:function(){
            var today=new Date().Format('yyyy-MM-dd');
            var start={
                format:'YYYY-MM-DD',
                zIndex:12345678,
                maxDate:today+' 00:00:00',
                okfun:function(v){
                    end.minDate =v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                    endDates();
                }
            };
            var end={
                format:'YYYY-MM-DD',
                zIndex:12345678,
                okfun:function(v){
                    start.maxDate=v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                }
            };
            function endDates() {
                //end.trigger = false;
                fui.$.jeDate('.form-submitBox .form-time-end',end);
            }
            var poll=function(){
                if(fui.$){
                    fui.$.jeDate('.form-submitBox .form-time-start',start);
                    fui.$.jeDate('.form-submitBox .form-time-end',end);
                }else{
                    setTimeout(poll,20)
                }
            };
            poll();
        },
        time2:function(dom){
            var today=new Date().Format('yyyy-MM-dd');
            var start={
                format:'YYYY-MM-DD',
                zIndex:12345678,
                maxDate:today+' 00:00:00'
            };
            var poll=function(){
                if(fui.$){
                    fui.$.jeDate(dom,start);
                }else{
                    setTimeout(poll,20)
                }
            };
            poll();
        },
        cTime:function(fmID){
            var today=new Date().Format('yyyy-MM-dd');
            var start={
                format:'YYYY-MM-DD',
                zIndex:12345678,
                maxDate:today+' 00:00:00',
                okfun:function(v){
                    end.minDate =v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                    endDates();
                }
            };
            var end={
                format:'YYYY-MM-DD',
                zIndex:12345678,
                okfun:function(v){
                    start.maxDate=v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                }
            };
            var sDom='.tab-item [data-form="'+fmID+'"] .form-time-start';
            var eDom='.tab-item [data-form="'+fmID+'"] .form-time-end';
            function endDates() {
                fui.$.jeDate(eDom,end);
            }
            var poll=function(){
                if(fui.$){
                    fui.$.jeDate(sDom,start);
                    fui.$.jeDate(eDom,end);
                }else{
                    setTimeout(poll,20)
                }
            };
            poll();
        },
        cTime2:function(fmID){
            var today=new Date().Format('yyyy-MM-dd');
            var start={
                format:'YYYY-MM-DD',
                zIndex:12345678,
                maxDate:today+' 00:00:00'
            };
            var sDom='.tab-item [data-form="'+fmID+'"] .form-time-start';
            var poll=function(){
                if(fui.$){
                    fui.$.jeDate(sDom,start);
                }else{
                    setTimeout(poll,20)
                }
            };
            poll();
        }
    },
    page:{
        i:function(){
            this.loadTable();
            JsForm().skin();
        },
        loadTable:function(){
            EPS.staff.d.eTable=JsTable('.mod-table').render({
                height:'full-200',
                limit:20,
                checkbox:true,
                map:{
                    name:'userInfo.name',
                    sex:'userInfo.sex',
                    age:'userInfo.age',
                    national:'userInfo.national',
                    marital:'userInfo.marital',
                    NativePlace:'userInfo.NativePlace'
                },
                cols:[
                    {field:'department',title:'所在部门',width:100},
                    {field:'job',title:'岗位名称',width:110},
                    {field:'state',title:'在职状态',width:80,align:'center'},
                    {field:'EmployeeType',title:'员工类别',width:100},
                    {field:'EmployeeNumber',title:'员工编号',width:100},
                    {field:'name',title:'姓名',width:100},
                    {field:'card',title:'身份证号',width:200},
                    {field:'sex',title:'性别',align:'center',width:60},
                    {field:'age',title:'年龄',align:'center'},
                    {field:'national',title:'民族',align:'center'},
                    {field:'NativePlace',title:'籍贯',width:100},
                    {field:'phone',title:'手机号码',width:110},
                    {field:'marital',title:'婚姻状态',width:100}
                ],
                event:'EPS.staff.btn.manage',
                staticData:epsData.employInformation
            });
        },
        loadStaffTable:function(reLoad){//员工的信息表格
            EPS.staff.com.table_0(reLoad);
        }
    },
    btn:{
        i:function(){
            this.tab();
        },
        tab:function(){
            var _Body=fui.$('body');
            _Body.on('click','.ts-nav li',function(){
                var _t=fui.$(this),tb=_t.parent().next('.ts-tabCon');
                if(!_t.hasClass('ts-checked')){
                    var idx=_t.index();
                    _t.addClass('ts-checked').siblings().removeClass('ts-checked');
                    tb.find('.ts-con').hide().eq(idx).show();
                    EPS.staff.com['table_'+idx].call(this);
                }
            });
            _Body.on('click','.form-tab-nav li',function(){
                var _t=fui.$(this),tb=_t.parents('.form-tab-nav').next('.form-tab-con');
                if(!_t.hasClass('checked')){
                    var idx=_t.index();
                    _t.addClass('checked').siblings().removeClass('checked');
                    tb.find('.tab-item').hide().eq(idx).show();
                }
            });
        },
        manage:function(tr,idx){
            var _t=fui.$(tr);
            fui.$('.tips-staffInfo').remove();
            if(_t.hasClass('tr-checked')){
                _t.removeClass('tr-checked');
            }else{
                _t.addClass('tr-checked').siblings().removeClass('tr-checked');
                _t.after(JsTpl().render({index:idx},'tips-staffInfo'));
                EPS.staff.page.loadStaffTable(1);
            }
        },
        addStaff:function(){
            var ly=layer.open({
                title:'添加员工信息',
                content:JsTpl().render({},'tips-addStaff'),
                btn:['保存','继续添加','取消'],
                skin:'tips-addStaff',
                resize:!1,
                yes:function(){
                    layer.msg('数据参数待定')
                },
                btn2:function(){

                    return false
                }
            });
            //添加教育模块
            JsTpl('.tips-addStaff [data-fill="education"] .tab-item').render({'form_ID':'education_'+1},'tips-addEducation');
            EPS.staff.com.cTime('education_'+1);
            //添加家庭模块
            JsTpl('.tips-addStaff [data-fill="family"] .tab-item').render({'form_ID':'family_'+1},'tips-addFamily');
            EPS.staff.com.cTime2('family_'+1);
            //添加执业模块
            JsTpl('.tips-addStaff [data-fill="practice"] .tab-item').render({'form_ID':'practice_'+1},'tips-addPractice');
            EPS.staff.com.cTime2('practice_'+1);
            //添加特种模块
            JsTpl('.tips-addStaff [data-fill="special"] .tab-item').render({'form_ID':'special_'+1},'tips-addPractice');
            EPS.staff.com.cTime2('special_'+1);
            //添加工作模块
            JsTpl('.tips-addStaff [data-fill="work"] .tab-item').render({'form_ID':'work_'+1},'tips-addWork');
            EPS.staff.com.cTime('work_'+1);
            //添加培训模块
            JsTpl('.tips-addStaff [data-fill="train"] .tab-item').render({'form_ID':'train_'+1},'tips-addTrain');
            EPS.staff.com.cTime('train_'+1);

            EPS.staff.com.time2('.tips-addStaff .form-time-before[name="birthDate"]');
            EPS.staff.com.time2('.tips-addStaff .form-time-before[name="partyDate"]');
            EPS.staff.com.time2('.tips-addStaff .form-time-before[name="issueDate"]');
        },
        addTab:{
            tab1:function(){
                if(EPS.staff.d.tab1){
                    EPS.staff.d.tab1++
                }else{
                    EPS.staff.d.tab1=2
                }
                if(EPS.staff.d.tab1>6){
                    EPS.staff.d.tab1=6;
                    return layer.msg('当前只支持6个');
                }
                var con=fui.$('.tips-addStaff [data-fill="education"]'),
                    ol=con.prev('.form-tab-nav').find('ol');
                ol.append('<li>教育经历'+EPS.staff.d.tab1+'</li>');
                con.append('<div class="tab-item"></div>');
                JsTpl('.tips-addStaff [data-fill="education"] .tab-item:last-child').render({'form_ID':'education_'+EPS.staff.d.tab1},'tips-addEducation');
                EPS.staff.com.cTime('education_'+EPS.staff.d.tab1);
            },
            tab2:function(){
                if(EPS.staff.d.tab2){
                    EPS.staff.d.tab2++
                }else{
                    EPS.staff.d.tab2=2
                }
                if(EPS.staff.d.tab2>6){
                    EPS.staff.d.tab2=6;
                    return layer.msg('当前只支持6个');
                }
                var con=fui.$('.tips-addStaff [data-fill="family"]'),
                    ol=con.prev('.form-tab-nav').find('ol');
                ol.append('<li>家庭成员'+EPS.staff.d.tab2+'</li>');
                con.append('<div class="tab-item"></div>');
                JsTpl('.tips-addStaff [data-fill="family"] .tab-item:last-child').render({'form_ID':'family_'+EPS.staff.d.tab2},'tips-addFamily');
                EPS.staff.com.cTime2('family_'+EPS.staff.d.tab2);
            },
            tab3:function(){
                if(EPS.staff.d.tab3){
                    EPS.staff.d.tab3++
                }else{
                    EPS.staff.d.tab3=2
                }
                if(EPS.staff.d.tab3>6){
                    EPS.staff.d.tab3=6;
                    return layer.msg('当前只支持6个');
                }
                var con=fui.$('.tips-addStaff [data-fill="practice"]'),
                    ol=con.prev('.form-tab-nav').find('ol');
                ol.append('<li>执业资格信息'+EPS.staff.d.tab3+'</li>');
                con.append('<div class="tab-item"></div>');
                JsTpl('.tips-addStaff [data-fill="practice"] .tab-item:last-child').render({'form_ID':'practice_'+EPS.staff.d.tab3},'tips-addPractice');
                EPS.staff.com.cTime2('practice_'+EPS.staff.d.tab3);
            },
            tab4:function(){
                if(EPS.staff.d.tab4){
                    EPS.staff.d.tab4++
                }else{
                    EPS.staff.d.tab4=2
                }
                if(EPS.staff.d.tab4>6){
                    EPS.staff.d.tab4=6;
                    return layer.msg('当前只支持6个');
                }
                var con=fui.$('.tips-addStaff [data-fill="special"]'),
                    ol=con.prev('.form-tab-nav').find('ol');
                ol.append('<li>特种执业信息'+EPS.staff.d.tab4+'</li>');
                con.append('<div class="tab-item"></div>');
                JsTpl('.tips-addStaff [data-fill="special"] .tab-item:last-child').render({'form_ID':'special_'+EPS.staff.d.tab4},'tips-addPractice');
                EPS.staff.com.cTime2('special_'+EPS.staff.d.tab4);
            },
            tab5:function(){
                if(EPS.staff.d.tab5){
                    EPS.staff.d.tab5++
                }else{
                    EPS.staff.d.tab5=2
                }
                if(EPS.staff.d.tab5>6){
                    EPS.staff.d.tab5=6;
                    return layer.msg('当前只支持6个');
                }
                var con=fui.$('.tips-addStaff [data-fill="work"]'),
                    ol=con.prev('.form-tab-nav').find('ol');
                ol.append('<li>工作单位'+EPS.staff.d.tab5+'</li>');
                con.append('<div class="tab-item"></div>');
                JsTpl('.tips-addStaff [data-fill="work"] .tab-item:last-child').render({'form_ID':'work_'+EPS.staff.d.tab5},'tips-addWork');
                EPS.staff.com.cTime('work_'+EPS.staff.d.tab5);
            },
            tab6:function(){
                if(EPS.staff.d.tab6){
                    EPS.staff.d.tab6++
                }else{
                    EPS.staff.d.tab6=2
                }
                if(EPS.staff.d.tab6>6){
                    EPS.staff.d.tab6=6;
                    return layer.msg('当前只支持6个');
                }
                var con=fui.$('.tips-addStaff [data-fill="train"]'),
                    ol=con.prev('.form-tab-nav').find('ol');
                ol.append('<li>培训经历'+EPS.staff.d.tab6+'</li>');
                con.append('<div class="tab-item"></div>');
                JsTpl('.tips-addStaff [data-fill="train"] .tab-item:last-child').render({'form_ID':'train_'+EPS.staff.d.tab6},'tips-addTrain');
                EPS.staff.com.cTime('train_'+EPS.staff.d.tab6);
            }
        },
        toAddWork:function(idx){//添加工作经历
            EPS.staff.d.eTable.dataBack(idx,function(td){
                var ly=layer.open({
                    title:'添加',
                    content:JsTpl().render(td,'tips-basic'),
                    btn:['保存','继续添加','取消'],
                    skin:'tips-addSupplement',
                    resize:!1,
                    yes:function(){
                        JsForm('.form-submitBox form').submit(function(rf){
                            if(rf.code==1){
                                layer.msg('保存成功');
                                layer.close(ly);
                            }else{
                                layer.msg(rf.msg)
                            }
                        },1)
                    },
                    btn2:function(){
                        JsForm('.form-submitBox form').submit(function(rf){
                            if(rf.code==1){
                                layer.msg('保存成功');
                                fui.$('.tips-addSupplement .form-submitBox').find('.form-item-input').val('')
                            }else{
                                layer.msg(rf.msg)
                            }
                        },1);
                        return false;
                    }
                });
                JsTpl('.tips-addSupplement .form-submitBox').render({},'tips-addWork');
                EPS.staff.com.time();
            });
        },
        toAddEducation:function(idx){//添加教育经历
            EPS.staff.d.eTable.dataBack(idx,function(td){
                var ly=layer.open({
                    title:'添加',
                    content:JsTpl().render(td,'tips-basic'),
                    btn:['保存','继续添加','取消'],
                    skin:'tips-addSupplement',
                    resize:!1,
                    yes:function(){
                        JsForm('.form-submitBox form').submit(function(rf){
                            if(rf.code==1){
                                layer.msg('保存成功');
                                layer.close(ly);
                            }else{
                                layer.msg(rf.msg)
                            }
                        },1)
                    },
                    btn2:function(){
                        JsForm('.form-submitBox form').submit(function(rf){
                            if(rf.code==1){
                                layer.msg('保存成功');
                                fui.$('.tips-addSupplement .form-submitBox').find('.form-item-input').val('');
                                fui.$('.tips-addSupplement .form-submitBox').find('.form-image-box').empty();
                                fui.$('.tips-addSupplement .form-submitBox').find('.fui-checkbox-checked').removeClass('fui-checkbox-checked');
                            }else{
                                layer.msg(rf.msg)
                            }
                        },1);
                        return false;
                    }
                });
                JsTpl('.tips-addSupplement .form-submitBox').render({},'tips-addEducation');
                EPS.staff.com.time();
            });
        },
        toAddTrain:function(idx){//添加培训经历
            EPS.staff.d.eTable.dataBack(idx,function(td){
                var ly=layer.open({
                    title:'添加',
                    content:JsTpl().render(td,'tips-basic'),
                    btn:['保存','继续添加','取消'],
                    skin:'tips-addSupplement',
                    resize:!1,
                    yes:function(){
                        JsForm('.form-submitBox form').submit(function(rf){
                            if(rf.code==1){
                                layer.msg('保存成功');
                                layer.close(ly);
                            }else{
                                layer.msg(rf.msg)
                            }
                        },1)
                    },
                    btn2:function(){
                        JsForm('.form-submitBox form').submit(function(rf){
                            if(rf.code==1){
                                layer.msg('保存成功');
                                fui.$('.tips-addSupplement .form-submitBox').find('.form-item-input').val('')
                            }else{
                                layer.msg(rf.msg)
                            }
                        },1);
                        return false;
                    }
                });
                JsTpl('.tips-addSupplement .form-submitBox').render({},'tips-addTrain');
                EPS.staff.com.time();
            });
        },
        toAddPractice:function(idx){//添加执业信息
            EPS.staff.d.eTable.dataBack(idx,function(td){
                var ly=layer.open({
                    title:'添加',
                    content:JsTpl().render(td,'tips-basic'),
                    btn:['保存','继续添加','取消'],
                    skin:'tips-addSupplement',
                    resize:!1,
                    yes:function(){
                        JsForm('.form-submitBox form').submit(function(rf){
                            if(rf.code==1){
                                layer.msg('保存成功');
                                layer.close(ly);
                            }else{
                                layer.msg(rf.msg)
                            }
                        },1)
                    },
                    btn2:function(){
                        JsForm('.form-submitBox form').submit(function(rf){
                            if(rf.code==1){
                                layer.msg('保存成功');
                                fui.$('.tips-addSupplement .form-submitBox').find('.form-item-input').val('')
                            }else{
                                layer.msg(rf.msg)
                            }
                        },1);
                        return false;
                    }
                });
                JsTpl('.tips-addSupplement .form-submitBox').render({},'tips-addPractice');
                EPS.staff.com.time2('.form-submitBox .form-time-start');
            });
        },
        toAddFamily:function(idx){//添加家庭背景
            EPS.staff.d.eTable.dataBack(idx,function(td){
                var ly=layer.open({
                    title:'添加',
                    content:JsTpl().render(td,'tips-basic'),
                    btn:['保存','继续添加','取消'],
                    skin:'tips-addSupplement',
                    resize:!1,
                    yes:function(){
                        JsForm('.form-submitBox form').submit(function(rf){
                            if(rf.code==1){
                                layer.msg('保存成功');
                                layer.close(ly);
                            }else{
                                layer.msg(rf.msg)
                            }
                        },1)
                    },
                    btn2:function(){
                        JsForm('.form-submitBox form').submit(function(rf){
                            if(rf.code==1){
                                layer.msg('保存成功');
                                fui.$('.tips-addSupplement .form-submitBox').find('.form-item-input').val('')
                            }else{
                                layer.msg(rf.msg)
                            }
                        },1);
                        return false;
                    }
                });
                JsTpl('.tips-addSupplement .form-submitBox').render({},'tips-addFamily');
                EPS.staff.com.time2('.form-submitBox .form-time-start');
            });
        },
        toDelAdvantage:function(tt){//删除优势资源内容项
            var _t=fui.$(tt);
            _t.parent('.tsc-ad').remove();
        },
        toEdit:{//修改
            mainTable:function(){
                var len=EPS.staff.d.eTable.cache.checked.length;
                if(len>1){
                    return layer.msg('只能同时修改一项')
                }else if(len==0){
                    return layer.msg('请选择一项进行修改');
                }
                layer.open({
                    title:'修改',
                    content:'结构同添加,暂不展示',
                    btn:['修改','取消'],
                    skin:'tips-addStaff',
                    resize:!1,
                    yes:function(){

                    }
                })
            },
            work:function(idx){
                var len=EPS.staff.d.Table1.cache.checked.length;
                if(len>1){
                    return layer.msg('只能同时修改一项')
                }else if(len==0){
                    return layer.msg('请选择一项进行修改');
                }
                EPS.staff.d.eTable.dataBack(idx,function(td){
                    var ly=layer.open({
                        title:'修改',
                        content:JsTpl().render(td,'tips-basic'),
                        btn:['修改','取消'],
                        skin:'tips-addSupplement',
                        resize:!1,
                        yes:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('修改成功');
                                    layer.close(ly);
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1)
                        }
                    });
                    JsTpl('.tips-addSupplement .form-submitBox').render(EPS.staff.d.Table1.cache.checked[0],'tips-addWork');
                    EPS.staff.com.time();
                });
            },
            education:function(idx){
                var len=EPS.staff.d.Table2.cache.checked.length;
                if(len>1){
                    return layer.msg('只能同时修改一项')
                }else if(len==0){
                    return layer.msg('请选择一项进行修改');
                }
                EPS.staff.d.eTable.dataBack(idx,function(td){
                    var ly=layer.open({
                        title:'修改',
                        content:JsTpl().render(td,'tips-basic'),
                        btn:['修改','取消'],
                        skin:'tips-addSupplement',
                        resize:!1,
                        yes:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('修改成功');
                                    layer.close(ly);
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1)
                        }
                    });
                    JsTpl('.tips-addSupplement .form-submitBox').render(EPS.staff.d.Table2.cache.checked[0],'tips-addEducation');
                    JsForm('.tips-addSupplement .form-submitBox').render();
                    EPS.staff.com.time();
                });
            },
            train:function(idx){
                var len=EPS.staff.d.Table3.cache.checked.length;
                if(len>1){
                    return layer.msg('只能同时修改一项')
                }else if(len==0){
                    return layer.msg('请选择一项进行修改');
                }
                EPS.staff.d.eTable.dataBack(idx,function(td){
                    var ly=layer.open({
                        title:'修改',
                        content:JsTpl().render(td,'tips-basic'),
                        btn:['修改','取消'],
                        skin:'tips-addSupplement',
                        resize:!1,
                        yes:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('修改成功');
                                    layer.close(ly);
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1)
                        }
                    });
                    JsTpl('.tips-addSupplement .form-submitBox').render(EPS.staff.d.Table3.cache.checked[0],'tips-addTrain');
                    EPS.staff.com.time();
                });
            },
            practice:function(idx){
                var len=EPS.staff.d.Table4.cache.checked.length;
                if(len>1){
                    return layer.msg('只能同时修改一项')
                }else if(len==0){
                    return layer.msg('请选择一项进行修改');
                }
                EPS.staff.d.eTable.dataBack(idx,function(td){
                    var ly=layer.open({
                        title:'修改',
                        content:JsTpl().render(td,'tips-basic'),
                        btn:['修改','取消'],
                        skin:'tips-addSupplement',
                        resize:!1,
                        yes:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('修改成功');
                                    layer.close(ly);
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1)
                        }
                    });
                    JsTpl('.tips-addSupplement .form-submitBox').render(EPS.staff.d.Table4.cache.checked[0],'tips-addPractice');
                    EPS.staff.com.time2('.form-submitBox .form-time-start');
                });
            },
            family:function(idx){
                var len=EPS.staff.d.Table5.cache.checked.length;
                if(len>1){
                    return layer.msg('只能同时修改一项')
                }else if(len==0){
                    return layer.msg('请选择一项进行修改');
                }
                EPS.staff.d.eTable.dataBack(idx,function(td){
                    var ly=layer.open({
                        title:'修改',
                        content:JsTpl().render(td,'tips-basic'),
                        btn:['修改','取消'],
                        skin:'tips-addSupplement',
                        resize:!1,
                        yes:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('修改成功');
                                    layer.close(ly);
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1)
                        }
                    });
                    JsTpl('.tips-addSupplement .form-submitBox').render(EPS.staff.d.Table5.cache.checked[0],'tips-addFamily');
                    EPS.staff.com.time2('.form-submitBox .form-time-start');
                });
            }
        },
        toDel:{//删除
            mainTable:function(){
                EPS.staff.d.eTable.checkBack(function(ck,cp){
                    if(ck.length==0) return layer.msg('请先勾选');
                    var ly=layer.open({
                        title:'删除',
                        content:'确认删除？',
                        skin:'tips-ts',
                        btn:['确定','取消'],
                        yes:function(){
                            layer.close(ly);
                            console.log('需要删除的id数组'+cp[0]);
                            layer.msg('删除成功');
                            EPS.staff.d.eTable.reload();
                        }
                    });
                },'id');
            },
            work:function(idx){
                EPS.staff.d.Table1.checkBack(function(ck,cp){
                    if(ck.length==0) return layer.msg('请先勾选');
                    var ly=layer.open({
                        title:'删除',
                        content:'确认删除？',
                        skin:'tips-ts',
                        btn:['确定','取消'],
                        yes:function(){
                            layer.close(ly);
                            EPS.staff.d.eTable.dataBack(idx,function(td){
                                console.log('需要删除的id数组'+cp[0]+',主表id:'+td.id);
                                layer.msg('删除成功');
                            });
                            EPS.staff.com.table_0(1);//测试用法
                            //EPS.staff.d.Table1.reload();---上线时,选择此方法重载
                        }
                    });
                },'id')
            },
            education:function(idx){
                EPS.staff.d.Table2.checkBack(function(ck,cp){
                    if(ck.length==0) return layer.msg('请先勾选');
                    var ly=layer.open({
                        title:'删除',
                        content:'确认删除？',
                        skin:'tips-ts',
                        btn:['确定','取消'],
                        yes:function(){
                            layer.close(ly);
                            EPS.staff.d.eTable.dataBack(idx,function(td){
                                console.log('需要删除的id数组'+cp[0]+',主表id:'+td.id);
                                layer.msg('删除成功');
                            });
                            EPS.staff.com.table_1(1);//测试用法
                            //EPS.staff.d.Table1.reload();---上线时,选择此方法重载
                        }
                    });
                },'id')
            },
            train:function(idx){
                EPS.staff.d.Table3.checkBack(function(ck,cp){
                    if(ck.length==0) return layer.msg('请先勾选');
                    var ly=layer.open({
                        title:'删除',
                        content:'确认删除？',
                        skin:'tips-ts',
                        btn:['确定','取消'],
                        yes:function(){
                            layer.close(ly);
                            EPS.staff.d.eTable.dataBack(idx,function(td){
                                console.log('需要删除的id数组'+cp[0]+',主表id:'+td.id);
                                layer.msg('删除成功');
                            });
                            EPS.staff.com.table_2(1);//测试用法
                            //EPS.staff.d.Table1.reload();---上线时,选择此方法重载
                        }
                    });
                },'id')
            },
            practice:function(idx){
                EPS.staff.d.Table4.checkBack(function(ck,cp){
                    if(ck.length==0) return layer.msg('请先勾选');
                    var ly=layer.open({
                        title:'删除',
                        content:'确认删除？',
                        skin:'tips-ts',
                        btn:['确定','取消'],
                        yes:function(){
                            layer.close(ly);
                            EPS.staff.d.eTable.dataBack(idx,function(td){
                                console.log('需要删除的id数组'+cp[0]+',主表id:'+td.id);
                                layer.msg('删除成功');
                            });
                            EPS.staff.com.table_3(1);//测试用法
                            //EPS.staff.d.Table1.reload();---上线时,选择此方法重载
                        }
                    });
                },'id')
            },
            family:function(idx){
                EPS.staff.d.Table5.checkBack(function(ck,cp){
                    if(ck.length==0) return layer.msg('请先勾选');
                    var ly=layer.open({
                        title:'删除',
                        content:'确认删除？',
                        skin:'tips-ts',
                        btn:['确定','取消'],
                        yes:function(){
                            layer.close(ly);
                            EPS.staff.d.eTable.dataBack(idx,function(td){
                                console.log('需要删除的id数组'+cp[0]+',主表id:'+td.id);
                                layer.msg('删除成功');
                            });
                            EPS.staff.com.table_4(1);//测试用法
                            //EPS.staff.d.Table1.reload();---上线时,选择此方法重载
                        }
                    });
                },'id')
            }
        },
        toSearch:function(v){
            v='object'===typeof v?fui.$(v).prev('.search-ipt').val():v;
            v=v.replace(/\s/gi,'');
            if(v){
                console.log('搜索 '+v);
            }

        }
    }
};
//劳动合同
EPS.contract={
    d:{},
    i:function(){
        this.page.i();
        this.btn.i();
    },
    com:{
        table_0:function(){
            EPS.contract.d.Table1=JsTable('.tsc-table[data-table="1"]').render({
                limit:10,
                checkbox:true,
                cols:[
                    {field:'department',title:'所在部门',width:150},
                    {field:'job',title:'岗位名称',width:120},
                    {field:'state',title:'在职状态',width:100,align:'center'},
                    {field:'name',title:'姓名',width:80},
                    {field:'card',title:'身份证号',width:160},
                    {field:'contractType',title:'本次续签合同类型',width:150},
                    {field:'startTime',title:'续签开始日期',width:130},
                    {field:'endTime',title:'续签到期日期',width:130},
                    {field:'timeLimit',title:'续签合同期限',width:130},
                    {field:'number',title:'续签次数',width:100},
                    {field:'lastStartTime',title:'上次合同开始日期',width:130}
                ],
                staticData:epsData.contractXq
            });
        },
        table_1:function(){
            EPS.contract.d.Table2=JsTable('.tsc-table[data-table="2"]').render({
                limit:10,
                checkbox:true,
                noRightBorder:true,//无右边框
                cols:[
                    {field:'compensation',title:'',width:90,fun:function(){return '<div class="compensation-box"><a href="javascript:;" class="compensation-btn">赔偿情况</a></div>'}},
                    {field:'department',title:'所在部门',width:100},
                    {field:'job',title:'岗位名称',width:100},
                    {field:'state',title:'在职状态',width:80,align:'center'},
                    {field:'name',title:'姓名',width:80},
                    {field:'card',title:'身份证号',width:160},
                    {field:'firstTime',title:'首次合同开始日期',width:130},
                    {field:'expireTime',title:'当前合同到期日期',width:130},
                    {field:'contractType',title:'当前合同类型',width:110},
                    {field:'terminationReason',title:'合同终止原因',width:130},
                    {field:'terminationTime',title:'合同终止日期',width:130},
                    {field:'resignation',title:'离职手续办完日期',width:130}
                ],
                staticData:epsData.contractZz
            });
        },
        table_2:function(){
            EPS.contract.d.Table3=JsTable('.tsc-table[data-table="3"]').render({
                limit:10,
                checkbox:true,
                cols:[
                    {field:'department',title:'所在部门',width:130},
                    {field:'job',title:'岗位名称',width:110},
                    {field:'state',title:'在职状态',width:80,align:'center'},
                    {field:'name',title:'姓名',width:80},
                    {field:'card',title:'身份证号',width:160},
                    {field:'changesAs',title:'变更事项',width:120},
                    {field:'original',title:'原合同内容',width:150},
                    {field:'post',title:'变更后内容',width:150},
                    {field:'effectTime',title:'变更生效日期',width:130}
                ],
                staticData:epsData.contractBg
            });
        },
        table_pc:function(){//赔偿金表格
            EPS.contract.d.pcTable=JsTable('.tcp-table').render({
                limit:10,
                checkbox:true,
                cols:[
                    {field:'type',title:'补偿金类型',width:90},
                    {field:'standard',title:'标准',width:90},
                    {field:'months',title:'月数',width:90},
                    {field:'amount',title:'金额'}
                ],
                staticData:epsData.pcTable
            });
        },
        time:function(sDom,eDom){
            var today=new Date().Format('yyyy-MM-dd');
            if(eDom){
                var start={
                    format:'YYYY-MM-DD',
                    zIndex:12345678,
                    maxDate:today+' 00:00:00',
                    okfun:function(v){
                        end.minDate =v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                        endDates();
                    }
                };
                var end={
                    format:'YYYY-MM-DD',
                    zIndex:12345678,
                    okfun:function(v){
                        start.maxDate=v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                    }
                };
                function endDates() {
                    fui.$.jeDate(eDom,end);
                }
                var poll=function(){
                    if(fui.$){
                        fui.$.jeDate(sDom,start);
                        fui.$.jeDate(eDom,end);
                    }else{
                        setTimeout(poll,20)
                    }
                };
                poll();
            }else{
                var before={
                    format:'YYYY-MM-DD',
                    zIndex:12345678,
                    maxDate:today+' 00:00:00'
                };
                var poll2=function(){
                    if(fui.$){
                        fui.$.jeDate(sDom,before);
                    }else{
                        setTimeout(poll2,20)
                    }
                };
                poll2();
            }
        },
        time2:function(dom){//可以是今天以后的时间
            var poll=function(){
                if(fui.$){
                    fui.$.jeDate(dom,{
                        format:'YYYY-MM-DD',
                        zIndex:12345678
                    });
                }else{
                    setTimeout(poll,20)
                }
            };
            poll();
        }
    },
    page:{
        i:function(){
            this.loadTable();
            JsForm().skin();
        },
        loadTable:function(){
            EPS.contract.d.eTable=JsTable('.mod-table').render({
                height:'full-200',
                limit:20,
                checkbox:true,
                map:{
                    name:'userInfo.name'
                },
                cols:[
                    {field:'department',title:'所在部门',width:100},
                    {field:'job',title:'岗位名称',width:110},
                    {field:'state',title:'在职状态',width:80,align:'center'},
                    {field:'EmployeeNumber',title:'员工编号',width:100},
                    {field:'name',title:'姓名',width:100},
                    {field:'card',title:'身份证号',width:200},
                    {field:'contractType',title:'合同类型',width:100},
                    {field:'contractStartTime',title:'合同开始日期',width:120},
                    {field:'contractEndTime',title:'合同结束日期',width:120},
                    {field:'trailStartTime',title:'试用开始日期',width:120},
                    {field:'trailEndTime',title:'试用结束日期',width:120},
                    {field:'positiveTime',title:'实际转正日期',width:120}
                ],
                event:'EPS.contract.btn.manage',
                staticData:epsData.contract
            });
        },
        loadContractTable:function(reLoad){
            EPS.contract.com.table_0(reLoad);
        }
    },
    btn:{
        i:function(){
            this.tab();
            this.compensationTips();
        },
        tab:function(){
            var _Body=fui.$('body');
            _Body.on('click','.ts-nav li',function(){
                var _t=fui.$(this),tb=_t.parent().next('.ts-tabCon');
                if(!_t.hasClass('ts-checked')){
                    var idx=_t.index();
                    _t.addClass('ts-checked').siblings().removeClass('ts-checked');
                    tb.find('.ts-con').hide().eq(idx).show();
                    EPS.contract.com['table_'+idx].call(this);
                }
            });
        },
        manage:function(tr,idx){
            var _t=fui.$(tr);
            fui.$('.tips-contractInfo').remove();
            if(_t.hasClass('tr-checked')){
                _t.removeClass('tr-checked');
            }else{
                _t.addClass('tr-checked').siblings().removeClass('tr-checked');
                _t.after(JsTpl().render({index:idx},'tips-contractInfo'));
                EPS.contract.page.loadContractTable(1);
            }
        },
        toAdd:{
            renew:function(idx){
                EPS.contract.d.eTable.dataBack(idx,function(td){
                    var ly=layer.open({
                        title:'添加',
                        content:JsTpl().render(td,'tips-basic'),
                        btn:['保存','继续添加','取消'],
                        skin:'tips-addSupplement',
                        resize:!1,
                        yes:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    layer.close(ly);
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1)
                        },
                        btn2:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    fui.$('.tips-addSupplement .form-submitBox').find('.form-item-input').val('')
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1);
                            return false;
                        }
                    });
                    JsTpl('.tips-addSupplement .form-submitBox').render({},'tips-addRenew');
                    EPS.contract.com.time('.tips-addSupplement .form-time-start[name="signingTime"]');
                    EPS.contract.com.time('.tips-addSupplement .form-time-start[name="startTime"]','.tips-addSupplement .form-time-end[name="endTime"]');
                    EPS.contract.com.time('.tips-addSupplement .form-time-start[name="secretStartTime"]','.tips-addSupplement .form-time-end[name="secretEndTime"]');
                    EPS.contract.com.time('.tips-addSupplement .form-time-start[name="tradeStartTime"]','.tips-addSupplement .form-time-end[name="tradeEndTime"]');
                });
            },
            termination:function(idx){
                EPS.contract.d.eTable.dataBack(idx,function(td){
                    var ly=layer.open({
                        title:'添加',
                        content:JsTpl().render(td,'tips-basic'),
                        btn:['保存','继续添加','取消'],
                        skin:'tips-addSupplement',
                        resize:!1,
                        yes:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    layer.close(ly);
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1)
                        },
                        btn2:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    fui.$('.tips-addSupplement .form-submitBox').find('.form-item-input').val('')
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1);
                            return false;
                        }
                    });
                    JsTpl('.tips-addSupplement .form-submitBox').render({},'tips-addTermination');
                    EPS.contract.com.time('.tips-addSupplement .form-time-start[name="startTime"]','.tips-addSupplement .form-time-end[name="endTime"]');
                    EPS.contract.com.time2('.tips-addSupplement .form-time-end[name="terminationTime"]');
                    EPS.contract.com.time2('.tips-addSupplement .form-time-end[name="transferredTime"]');
                });
            },
            change:function(idx){
                EPS.contract.d.eTable.dataBack(idx,function(td){
                    var ly=layer.open({
                        title:'添加',
                        content:JsTpl().render(td,'tips-basic'),
                        btn:['保存','继续添加','取消'],
                        skin:'tips-addSupplement',
                        resize:!1,
                        yes:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    layer.close(ly);
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1)
                        },
                        btn2:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    fui.$('.tips-addSupplement .form-submitBox').find('.form-item-input').val('')
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1);
                            return false;
                        }
                    });
                    JsTpl('.tips-addSupplement .form-submitBox').render({},'tips-addChange');
                    EPS.contract.com.time2('.tips-addSupplement .form-time-start[name="effectTime"]');
                });
            },
            compensation:function(idx){
                EPS.contract.d.eTable.dataBack(idx,function(td){
                    var ly=layer.open({
                        title:'添加',
                        content:JsTpl().render(td,'tips-basic'),
                        btn:['保存','继续添加','取消'],
                        skin:'tips-addSupplement',
                        resize:!1,
                        yes:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    layer.close(ly);
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1)
                        },
                        btn2:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    fui.$('.tips-addSupplement .form-submitBox').find('.form-item-input').val('')
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1);
                            return false;
                        }
                    });
                    JsTpl('.tips-addSupplement .form-submitBox').render({},'tips-addCompensation');
                });
            }
        },
        compensationTips:function(){//补偿弹窗
            var body=fui.$('body'),dict={};
            body.on('mouseenter','.tips-compensation',function(){
                dict.isEsb=true;
            }).on('mouseleave','.tips-compensation',function(){
                dict.isEsb=false;
                fui.$('.compensation-box').removeClass('compensation-hover');
                fui.$('.tips-compensation').remove()
            });
            body.on('mouseenter','.compensation-box',function(){
                var _t=fui.$(this);
                var idx=fui.$('.mod-table').find('.tr-checked').index();
                dict.time=setTimeout(function(){
                    var os={
                        top:_t.offset().top,
                        left:_t.offset().left,
                        w:_t.outerWidth()
                    };
                    _t.addClass('compensation-hover');
                    body.append(JsTpl().render({index:idx},'tips-compensation'));
                    EPS.contract.com.table_pc();
                    fui.$('.tips-compensation').css({top:os.top-35,left:os.left+os.w+12});
                    dict.isEsb=true;
                },200);
            }).on('mouseleave','.compensation-box',function(e){
                clearTimeout(dict.time);
                if(!dict.isEsb){
                    fui.$('.compensation-box').removeClass('compensation-hover');
                    fui.$('.tips-compensation').remove()
                }
            });
        },
        addContact:function(){
            var ly=layer.open({
                title:'添加',
                content:JsTpl().render({},'tips-addContract'),
                btn:['保存','继续添加','取消'],
                skin:'tips-addContact',
                resize:!1,
                yes:function(){
                    layer.msg('数据参数待定')
                },
                btn2:function(){

                    return false
                }
            });
            //时间控件初始化
            EPS.contract.com.time('.tips-addContact .form-time-start[name="signingTime"]');
            EPS.contract.com.time('.tips-addContact .form-time-start[name="startTime"]','.tips-addContact .form-time-end[name="endTime"]');
            EPS.contract.com.time('.tips-addContact .form-time-start[name="secretStartTime"]','.tips-addContact .form-time-end[name="secretEndTime"]');
            EPS.contract.com.time('.tips-addContact .form-time-start[name="tradeStartTime"]','.tips-addContact .form-time-end[name="tradeEndTime"]');
        },
        toSearch:function(v){
            v='object'===typeof v?fui.$(v).prev('.search-ipt').val():v;
            v=v.replace(/\s/gi,'');
            if(v){
                console.log('搜索 '+v);
            }

        }
    }
};
//社保金积金
EPS.assurance={
    d:{},
    i:function(){
        this.page.i();
        this.btn.i();
    },
    com:{
        table_0:function(){
            EPS.assurance.d.Table1=JsTable('.tsc-table[data-table="1"]').render({
                limit:10,
                checkbox:true,
                cols:[
                    {field:'name1',title:'申报日期',width:120},
                    {field:'name2',title:'申报事宜',width:120},
                    {field:'name3',title:'是否办结',width:100,align:'center'},
                    {field:'name4',title:'办结日期',width:120},
                    {field:'name5',title:'未办结原因',width:110},
                    {field:'name6',title:'社保核定待遇金额',width:120},
                    {field:'name7',title:'到账日期',width:120},
                    {field:'name8',title:'发放员工金额',width:100},
                    {field:'name9',title:'发放户名',width:100},
                    {field:'name10',title:'发放账号',width:130},
                    {field:'name11',title:'发放开户银行',width:110},
                    {field:'name12',title:'备注'}
                ],
                staticData:epsData.testData
            });
        },
        table_1:function(){
            EPS.assurance.d.Table2=JsTable('.tsc-table[data-table="2"]').render({
                limit:10,
                checkbox:true,
                cols:[
                    {field:'name1',title:'申报日期',width:120},
                    {field:'name2',title:'申报事宜',width:120},
                    {field:'name3',title:'是否办结',width:100,align:'center'},
                    {field:'name4',title:'办结日期',width:120},
                    {field:'name5',title:'未办结原因',width:110},
                    {field:'name6',title:'备注'}
                ],
                staticData:epsData.testData
            });
        },
        table_2:function(){
            EPS.assurance.d.Table3=JsTable('.tsc-table[data-table="3"]').render({
                limit:10,
                checkbox:true,
                cols:[
                    {field:'name1',title:'申报日期',width:120},
                    {field:'name2',title:'申报金额',width:120},
                    {field:'name2',title:'保险公司报销金额',width:120},
                    {field:'name2',title:'到账日期',width:120},
                    {field:'name2',title:'发放员工金额',width:120},
                    {field:'name2',title:'发放户名',width:120},
                    {field:'name2',title:'发放账号',width:120},
                    {field:'name2',title:'发放开户银行',width:120},
                    {field:'name6',title:'备注'}
                ],
                staticData:epsData.testData
            });
        },
        time:function(sDom,eDom){
            var today=new Date().Format('yyyy-MM-dd');
            if(eDom){
                var start={
                    format:'YYYY-MM-DD',
                    zIndex:12345678,
                    maxDate:today+' 00:00:00',
                    okfun:function(v){
                        end.minDate =v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                        endDates();
                    }
                };
                var end={
                    format:'YYYY-MM-DD',
                    zIndex:12345678,
                    okfun:function(v){
                        start.maxDate=v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                    }
                };
                function endDates() {
                    fui.$.jeDate(eDom,end);
                }
                var poll=function(){
                    if(fui.$){
                        fui.$.jeDate(sDom,start);
                        fui.$.jeDate(eDom,end);
                    }else{
                        setTimeout(poll,20)
                    }
                };
                poll();
            }else{
                var before={
                    format:'YYYY-MM-DD',
                    zIndex:12345678,
                    maxDate:today+' 00:00:00'
                };
                var poll2=function(){
                    if(fui.$){
                        fui.$.jeDate(sDom,before);
                    }else{
                        setTimeout(poll2,20)
                    }
                };
                poll2();
            }
        },
        time2:function(dom){//可以是今天以后的时间
            var poll=function(){
                if(fui.$){
                    fui.$.jeDate(dom,{
                        format:'YYYY-MM-DD',
                        zIndex:12345678
                    });
                }else{
                    setTimeout(poll,20)
                }
            };
            poll();
        }
    },
    page:{
        i:function(){
            this.loadTable();
            JsForm().skin();
        },
        loadTable:function(){
            EPS.assurance.d.eTable=JsTable('.mod-table').render({
                height:'full-200',
                limit:20,
                checkbox:true,
                map:{
                    name:'userInfo.name'
                },
                cols:[
                    {field:'department',title:'所在部门',width:100},
                    {field:'entryTime',title:'入职时间',width:120},
                    {field:'job',title:'岗位名称',width:110},
                    {field:'state',title:'在职状态',width:80,align:'center'},
                    {field:'security',title:'社保状态',width:80,align:'center'},
                    {field:'reserve',title:'金积金状态',width:90,align:'center'},
                    {field:'EmployeeNumber',title:'员工编号',width:100},
                    {field:'name',title:'姓名',width:80},
                    {field:'card',title:'身份证号',width:160},
                    {field:'social',title:'社保参保地',width:120},
                    {field:'Payment',title:'在本单位社保补缴时间',align:'center',width:140},
                    {field:'amount',title:'单位社保补缴费额',width:120}
                ],
                event:'EPS.assurance.btn.manage',
                staticData:epsData.assuranceTable
            });
        },
        loadAssuranceTable:function(){
            EPS.assurance.com.table_0();
        }
    },
    btn:{
        i:function(){
            this.tab();
        },
        tab:function(){
            var _Body=fui.$('body');
            _Body.on('click','.ts-nav li',function(){
                var _t=fui.$(this),tb=_t.parent().next('.ts-tabCon');
                if(!_t.hasClass('ts-checked')){
                    var idx=_t.index();
                    _t.addClass('ts-checked').siblings().removeClass('ts-checked');
                    tb.find('.ts-con').hide().eq(idx).show();
                    EPS.assurance.com['table_'+idx].call(this);
                }
            });
        },
        manage:function(tr,idx){
            var _t=fui.$(tr);
            fui.$('.tips-assuranceInfo').remove();
            if(_t.hasClass('tr-checked')){
                _t.removeClass('tr-checked');
            }else{
                _t.addClass('tr-checked').siblings().removeClass('tr-checked');
                _t.after(JsTpl().render({index:idx},'tips-assuranceInfo'));
                EPS.assurance.page.loadAssuranceTable();
            }
        },
        toAdd:{
            security:function(idx){
                EPS.assurance.d.eTable.dataBack(idx,function(td){
                    var ly=layer.open({
                        title:'添加社保申报记录',
                        content:JsTpl().render(td,'tips-basic'),
                        btn:['保存','继续添加','取消'],
                        skin:'tips-addSupplement',
                        resize:!1,
                        yes:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    layer.close(ly);
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1)
                        },
                        btn2:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    fui.$('.tips-addSupplement .form-submitBox').find('.form-item-input').val('')
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1);
                            return false;
                        }
                    });
                    JsTpl('.tips-addSupplement .form-submitBox').render({},'tips-addSecurity');
                    EPS.assurance.com.time2('.tips-addSupplement .form-time-start[name="declareTime"]');
                    EPS.assurance.com.time2('.tips-addSupplement .form-time-start[name="finishTime"]');
                    EPS.assurance.com.time2('.tips-addSupplement .form-time-start[name="accountTime"]');
                });
            },
            reserved:function(idx){
                EPS.assurance.d.eTable.dataBack(idx,function(td){
                    var ly=layer.open({
                        title:'添加公积金申报记录',
                        content:JsTpl().render(td,'tips-basic'),
                        btn:['保存','继续添加','取消'],
                        skin:'tips-addSupplement',
                        resize:!1,
                        yes:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    layer.close(ly);
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1)
                        },
                        btn2:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    fui.$('.tips-addSupplement .form-submitBox').find('.form-item-input').val('')
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1);
                            return false;
                        }
                    });
                    JsTpl('.tips-addSupplement .form-submitBox').render({},'tips-addSecurity');
                    EPS.assurance.com.time2('.tips-addSupplement .form-time-start[name="declareTime"]');
                    EPS.assurance.com.time2('.tips-addSupplement .form-time-start[name="finishTime"]');
                    EPS.assurance.com.time2('.tips-addSupplement .form-time-start[name="accountTime"]');
                });
            },
            business:function(idx){
                EPS.assurance.d.eTable.dataBack(idx,function(td){
                    var ly=layer.open({
                        title:'添加社保申报记录',
                        content:JsTpl().render(td,'tips-basic'),
                        btn:['保存','继续添加','取消'],
                        skin:'tips-addSupplement',
                        resize:!1,
                        yes:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    layer.close(ly);
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1)
                        },
                        btn2:function(){
                            JsForm('.form-submitBox form').submit(function(rf){
                                if(rf.code==1){
                                    layer.msg('保存成功');
                                    fui.$('.tips-addSupplement .form-submitBox').find('.form-item-input').val('')
                                }else{
                                    layer.msg(rf.msg)
                                }
                            },1);
                            return false;
                        }
                    });
                    JsTpl('.tips-addSupplement .form-submitBox').render({},'tips-addBusiness');
                    EPS.assurance.com.time2('.tips-addSupplement .form-time-start[name="declareTime"]');
                    EPS.assurance.com.time2('.tips-addSupplement .form-time-start[name="accountTime"]');
                });
            }
        },
        toAddAssurance:function(){
            var ly=layer.open({
                title:'添加社保公积金',
                content:fui.$('#tips-addAssurance').html(),
                btn:['保存','继续添加','保存为基数模版','取消'],
                resize:!1,
                skin:'tips-addAssurance',
                yes:function(){

                },
                btn2:function(){
                    return false
                },
                btn3:function(){
                    return false
                }
            });
        },
        toSearch:function(v){
            v='object'===typeof v?fui.$(v).prev('.search-ipt').val():v;
            v=v.replace(/\s/gi,'');
            if(v){
                console.log('搜索 '+v);
            }

        }
    }
};
//工资
EPS.salary={
    d:{},
    i:function(){
        this.page.i();
        this.btn.i();
    },
    page:{
        i:function(){
            this.loadTable();
            JsForm().skin();
        },
        loadTable:function(){
            EPS.salary.d.eTable=JsTable('.mod-table').render({
                height:'full-200',
                limit:20,
                checkbox:true,
                map:{
                    name:'userInfo.name'
                },
                cols:[
                    {field:'department',title:'所在部门',width:100},
                    {field:'entryTime',title:'入职时间',width:120},
                    {field:'job',title:'岗位名称',width:110},
                    {field:'state',title:'在职状态',width:80,align:'center'},
                    {field:'security',title:'社保状态',width:80,align:'center'},
                    {field:'reserve',title:'金积金状态',width:90,align:'center'},
                    {field:'EmployeeNumber',title:'员工编号',width:100},
                    {field:'name',title:'姓名',width:80},
                    {field:'card',title:'身份证号',width:160},
                    {field:'basicWage',title:'基本工资',width:100},
                    {field:'jobWage',title:'岗位工资',width:100},
                    {field:'overtimePay',title:'加班费',width:100},
                    {field:'meritPay',title:'绩效工资',width:100}
                ],
                staticData:epsData.salary
            });
        }
    },
    btn:{
        i:function(){

        },
        toAddSalary:function(){
            var ly=layer.open({
                title:'添加',
                content:JsTpl().render({},'tips-addSalary'),
                btn:['保存','继续添加','取消'],
                skin:'tips-addSalary',
                resize:!1,
                yes:function(){
                    layer.msg('数据参数待定')
                },
                btn2:function(){

                    return false
                }
            });

        },
        setSalaryItem:function(){
            var ly=layer.open({
                title:'设置工资项',
                content:fui.$('#tips-setSalary').html(),
                btn:['保存','取消'],
                skin:'tips-setSalary',
                resize:!1,
                yes:function(){

                }
            });
            EPS.salary.d.iTable=JsTable('.salaryItemTable').render({
                height:325,
                limit:20,
                checkbox:true,
                cols:[
                    {field:'salaryName',title:'名称',width:120},
                    {field:'add',title:'加项',width:100,align:'center'},
                    {field:'minus',title:'减项',width:100,align:'center'},
                    {field:'deactivate',title:'是否停用',width:100,align:'center',fun:function(key){
                        return '<div class="form-item-switch" fm-switch="OFF|ON" fm-value="0|1"><span>OFF</span><input type="text" value="'+key+'" hidden></div>'
                    }},
                    {field:'remark',title:'备注'}
                ],
                staticData:epsData.salaryItem
            });
            JsForm('.salaryItemTable').render();
        },
        toSearch:function(v){
            v='object'===typeof v?fui.$(v).prev('.search-ipt').val():v;
            v=v.replace(/\s/gi,'');
            if(v){
                console.log('搜索 '+v);
            }

        }
    }
};
//考勤
EPS.attendance={
    d:{},
    i:function(){
        this.page.i();
        this.btn.i();
    },
    com:{
        time:function(dom,hours){
            var poll=function(){
                if(fui.$){
                    var today=new Date().Format('yyyy-MM-dd');
                    var dpt={
                        zIndex:12345678
                    };
                    if(hours){
                        dpt['format']='hh:mm:ss'
                    }else{
                        dpt['format']='YYYY-MM-DD';
                        dpt['maxDate']=today+' 00:00:00';
                    }
                    fui.$.jeDate(dom,dpt);
                }else{
                    setTimeout(poll,20)
                }
            };
            poll();
        }
    },
    page:{
        i:function(){
            this.loadTable();
            JsForm().skin();
        },
        loadTable:function(){
            EPS.attendance.d.eTable=JsTable('.mod-table').render({
                height:'full-200',
                limit:20,
                checkbox:true,
                map:{
                    name:'userInfo.name'
                },
                cols:[
                    {field:'dateTime',title:'日期',width:120},
                    {field:'department',title:'所在部门',width:100},
                    {field:'job',title:'岗位名称',width:110},
                    {field:'state',title:'在职状态',width:80,align:'center'},
                    {field:'EmployeeNumber',title:'员工编号',width:100},
                    {field:'name',title:'姓名',width:80},
                    {field:'card',title:'身份证号',width:170},
                    {field:'attendanceType',title:'考勤类型',width:100,align:'center',fun:function(key){
                        var attArr=['正常','旷工','迟到','早退','加班','请假','其他'];
                        return '<span class="attColor_'+key+'">'+attArr[key]+'</span>'
                    }},
                    {field:'leaveType',title:'请假类型',width:100},
                    {field:'clockIn',title:'上班打卡时间',width:160},
                    {field:'offDuty',title:'下班打卡时间',width:160},
                    {field:'absenteeism',title:'旷工时长'}
                ],
                staticData:epsData.attendance
            });
        }
    },
    btn:{
        i:function(){},
        toAddAttendance:function(){
            var ly=layer.open({
                title:'添加',
                content:JsTpl().render({},'tips-addAttendance'),
                btn:['保存','继续添加','取消'],
                skin:'tips-addAttendance',
                resize:!1,
                yes:function(){
                    layer.msg('数据参数待定')
                },
                btn2:function(){

                    return false
                }
            });
            EPS.attendance.com.time('.tips-addAttendance .form-time-start[name="onDuty"]',1);
            EPS.attendance.com.time('.tips-addAttendance .form-time-end[name="offDuty"]',1);
            EPS.attendance.com.time('.tips-addAttendance .form-time-start[name="onWork"]',1);
            EPS.attendance.com.time('.tips-addAttendance .form-time-end[name="offWork"]',1);
            EPS.attendance.com.time('.tips-addAttendance .form-time-start[name="dateTime"]');
        },
        setAttendance:function(){
            var ly=layer.open({
                title:'上下班时间设置',
                content:JsTpl().render({},'tips-setTime'),
                btn:['确定','取消'],
                skin:'tips-setTime',
                resize:!1,
                yes:function(){
                    layer.msg('开发中');
                }
            });
            EPS.attendance.com.time('.tips-setTime .form-time-start[name="onDuty"]',1);
            EPS.attendance.com.time('.tips-setTime .form-time-end[name="offDuty"]',1);
        },
        toSearch:function(v){
            v='object'===typeof v?fui.$(v).prev('.search-ipt').val():v;
            v=v.replace(/\s/gi,'');
            if(v){
                console.log('搜索 '+v);
            }

        }
    }
};
//培训
EPS.train={
    d:{},
    i:function(){
        this.page.i();
        this.btn.i();
    },
    com:{
        time:function(dom,hours){
            var poll=function(){
                if(fui.$){
                    var today=new Date().Format('yyyy-MM-dd');
                    var dpt={
                        zIndex:12345678
                    };
                    if(hours){
                        dpt['format']='hh:mm:ss'
                    }else{
                        dpt['format']='YYYY-MM-DD';
                        dpt['maxDate']=today+' 00:00:00';
                    }
                    fui.$.jeDate(dom,dpt);
                }else{
                    setTimeout(poll,20)
                }
            };
            poll();
        },
        time2:function(sDom,eDom){
            var today=new Date().Format('yyyy-MM-dd');
            if(eDom){
                var start={
                    format:'YYYY-MM-DD hh:mm',
                    zIndex:12345678,
                    maxDate:today+' 00:00:00',
                    okfun:function(v){
                        end.minDate =v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                        endDates();
                    }
                };
                var end={
                    format:'YYYY-MM-DD hh:mm',
                    zIndex:12345678,
                    okfun:function(v){
                        start.maxDate=v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                    }
                };
                function endDates() {
                    fui.$.jeDate(eDom,end);
                }
                var poll=function(){
                    if(fui.$){
                        fui.$.jeDate(sDom,start);
                        fui.$.jeDate(eDom,end);
                    }else{
                        setTimeout(poll,20)
                    }
                };
                poll();
            }else{
                var before={
                    format:'YYYY-MM-DD',
                    zIndex:12345678,
                    maxDate:today+' 00:00:00'
                };
                var poll2=function(){
                    if(fui.$){
                        fui.$.jeDate(sDom,before);
                    }else{
                        setTimeout(poll2,20)
                    }
                };
                poll2();
            }
        }
    },
    page:{
        i:function(){
            this.loadTable();
            JsForm().skin();
        },
        loadTable:function(){
            EPS.train.d.eTable=JsTable('.mod-table').render({
                height:'full-200',
                limit:20,
                checkbox:true,
                map:{
                    name:'userInfo.name'
                },
                cols:[
                    {field:'trainTime',title:'培训时间',width:150},
                    {field:'trainWay',title:'培训方式',width:150},
                    {field:'trainSite',title:'培训地点',width:160},
                    {field:'trainContent',title:'培训内容'}
                ],
                event:'EPS.train.btn.manage',
                staticData:epsData.train
            });
        },
        loadScoreTable:function(){
            EPS.train.d.Table1=JsTable('.tsc-table').render({
                limit:10,
                checkbox:true,
                cols:[
                    {field:'name1',title:'所在部门',width:120},
                    {field:'name2',title:'岗位名称',width:100},
                    {field:'name3',title:'在职状态',width:100,align:'center'},
                    {field:'name4',title:'员工编号',width:100},
                    {field:'name5',title:'姓名',width:80},
                    {field:'name6',title:'身份证号',width:170},
                    {field:'name7',title:'培训成绩',width:100},
                    {field:'name8',title:'培训履约时间',width:130},
                    {field:'name9',title:'培训费用',width:100},
                    {field:'name10',title:'备注'}
                ],
                staticData:epsData.trainScore
            });
        }
    },
    btn:{
        i:function(){},
        manage:function(tr,idx){
            var _t=fui.$(tr);
            fui.$('.tips-trainInfo').remove();
            if(_t.hasClass('tr-checked')){
                _t.removeClass('tr-checked');
            }else{
                _t.addClass('tr-checked').siblings().removeClass('tr-checked');
                _t.after(JsTpl().render({index:idx},'tips-trainInfo'));
                EPS.train.page.loadScoreTable();
            }
        },
        toAddTrain:function(){
            var ly=layer.open({
                title:'添加',
                content:JsTpl().render({},'tips-addTrain'),
                btn:['保存','继续添加','取消'],
                skin:'tips-addTrain',
                resize:!1,
                yes:function(){

                },
                btn2:function(){

                }
            });
            EPS.train.d.manTable=JsTable('.tat-table').render({
                limit:10,
                checkbox:true,
                map:{
                    name:'userInfo.name'
                },
                cols:[
                    {field:'department',title:'所在部门',width:100},
                    {field:'job',title:'岗位名称',width:100},
                    {field:'state',title:'在职状态',width:80,align:'center'},
                    {field:'EmployeeNumber',title:'员工编号',width:100},
                    {field:'name',title:'姓名',width:80},
                    {field:'card',title:'身份证号',width:160}
                ],
                staticData:epsData.manData
            });
            EPS.train.com.time2('.tips-addTrain .form-time-start','.tips-addTrain .form-time-end');
        },
        toAddScore:function(){
            var ly=layer.open({
                title:'添加成绩',
                content:fui.$('#tips-addScore').html(),
                btn:['确定','取消'],
                skin:"tips-addScore",
                resize:!1,
                yes:function(){
                    layer.msg('开发中')
                }
            });
            EPS.train.com.time2('.tips-addScore .form-time-start','.tips-addScore .form-time-end');
        },
        toAddMan:function(){
            var ly=layer.open({
                title:'添加人员',
                content:fui.$('#tips-chooseMan').html(),
                btn:['确定','取消'],
                resize:!1,
                skin:'tips-chooseMan',
                yes:function(){

                }
            })
        },
        toSearch:function(v){
            v='object'===typeof v?fui.$(v).prev('.search-ipt').val():v;
            v=v.replace(/\s/gi,'');
            if(v){
                console.log('搜索 '+v);
            }

        }
    }
};
//体检
EPS.experience={
    d:{},
    i:function(){
        this.page.i();
        this.btn.i();
    },
    com:{
        time:function(dom,hours){
            var poll=function(){
                if(fui.$){
                    var today=new Date().Format('yyyy-MM-dd');
                    var dpt={
                        zIndex:12345678
                    };
                    if(hours){
                        dpt['format']='hh:mm:ss'
                    }else{
                        dpt['format']='YYYY-MM-DD';
                        dpt['maxDate']=today+' 00:00:00';
                    }
                    fui.$.jeDate(dom,dpt);
                }else{
                    setTimeout(poll,20)
                }
            };
            poll();
        },
        time2:function(sDom,eDom){
            var today=new Date().Format('yyyy-MM-dd');
            if(eDom){
                var start={
                    format:'YYYY-MM-DD hh:mm',
                    zIndex:12345678,
                    maxDate:today+' 00:00:00',
                    okfun:function(v){
                        end.minDate =v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                        endDates();
                    }
                };
                var end={
                    format:'YYYY-MM-DD hh:mm',
                    zIndex:12345678,
                    okfun:function(v){
                        start.maxDate=v.date['YYYY']+'-'+v.date['MM']+'-'+v.date['DD']+' 00:00:00';
                    }
                };
                function endDates() {
                    fui.$.jeDate(eDom,end);
                }
                var poll=function(){
                    if(fui.$){
                        fui.$.jeDate(sDom,start);
                        fui.$.jeDate(eDom,end);
                    }else{
                        setTimeout(poll,20)
                    }
                };
                poll();
            }else{
                var before={
                    format:'YYYY-MM-DD',
                    zIndex:12345678,
                    maxDate:today+' 00:00:00'
                };
                var poll2=function(){
                    if(fui.$){
                        fui.$.jeDate(sDom,before);
                    }else{
                        setTimeout(poll2,20)
                    }
                };
                poll2();
            }
        }
    },
    page:{
        i:function(){
            this.loadTable();
            JsForm().skin();
        },
        loadTable:function(){
            EPS.experience.d.eTable=JsTable('.mod-table').render({
                height:'full-200',
                limit:20,
                checkbox:true,
                map:{
                    name:'userInfo.name'
                },
                cols:[
                    {field:'medicalTime',title:'体检时间',width:150},
                    {field:'medicalHospital',title:'体检医院',width:180},
                    {field:'hospitalGrade',title:'医院等级',width:160},
                    {field:'medicalCosts',title:'体检费用'}
                ],
                event:'EPS.experience.btn.manage',
                staticData:epsData.experience
            });
        },
        loadConclusionTable:function(){
            EPS.experience.d.Table1=JsTable('.tsc-table').render({
                limit:10,
                cols:[
                    {field:'name1',title:'所在部门',width:120},
                    {field:'name2',title:'岗位名称',width:100},
                    {field:'name3',title:'在职状态',width:100,align:'center'},
                    {field:'name4',title:'员工编号',width:100},
                    {field:'name5',title:'姓名',width:80},
                    {field:'name6',title:'身份证号',width:170},
                    {field:'name7',title:'体检报告结论',width:180},
                    {field:'name10',title:'备注'}
                ],
                staticData:epsData.trainScore
            });
        }
    },
    btn:{
        i:function(){},
        manage:function(tr,idx){
            var _t=fui.$(tr);
            fui.$('.tips-experienceInfo').remove();
            if(_t.hasClass('tr-checked')){
                _t.removeClass('tr-checked');
            }else{
                _t.addClass('tr-checked').siblings().removeClass('tr-checked');
                _t.after(JsTpl().render({index:idx},'tips-experienceInfo'));
                EPS.experience.page.loadConclusionTable();
            }
        },
        toAddExperience:function(){
            var ly=layer.open({
                title:'添加',
                content:JsTpl().render({},'tips-addExperience'),
                btn:['保存','继续添加','取消'],
                skin:'tips-addExperience',
                resize:!1,
                yes:function(){

                },
                btn2:function(){

                }
            });
            EPS.experience.d.manTable=JsTable('.tat-table').render({
                limit:10,
                checkbox:true,
                map:{
                    name:'userInfo.name'
                },
                cols:[
                    {field:'department',title:'所在部门',width:100},
                    {field:'job',title:'岗位名称',width:100},
                    {field:'state',title:'在职状态',width:80,align:'center'},
                    {field:'EmployeeNumber',title:'员工编号',width:100},
                    {field:'name',title:'姓名',width:80},
                    {field:'card',title:'身份证号',width:160}
                ],
                staticData:epsData.manData
            });
            EPS.experience.com.time2('.tips-addExperience .form-time-start');
        },
        toAddConclusion:function(){
            var ly=layer.open({
                title:'添加体检结论',
                content:fui.$('#tips-addConclusion').html(),
                btn:['确定','取消'],
                skin:"tips-addConclusion",
                resize:!1,
                yes:function(){
                    layer.msg('开发中')
                }
            });
            EPS.train.com.time2('.tips-addConclusion .form-time-start','.tips-addConclusion .form-time-end');
        },
        toAddMan:function(){
            var ly=layer.open({
                title:'添加人员',
                content:fui.$('#tips-chooseMan').html(),
                btn:['确定','取消'],
                resize:!1,
                skin:'tips-chooseMan',
                yes:function(){

                }
            })
        },
        toSearch:function(v){
            v='object'===typeof v?fui.$(v).prev('.search-ipt').val():v;
            v=v.replace(/\s/gi,'');
            if(v){
                console.log('搜索 '+v);
            }

        }
    }
};
